﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using NK.Domain.Abstract;
using NK.Domain.Concrete;

namespace NK.WebUI.Controllers
{
    public class ProductController : Controller
    {
        public int PageSize = 3;//We will change it later
        private IProductRepository repository;

        public ProductController(IProductRepository repoParam)
        {
            repository = repoParam;
        }

        public ViewResult List(int page = 1)
        {
            return View(repository.Products.OrderBy(p=>p.ProductID)
                .Skip((page - 1)*PageSize)
                .Take(PageSize));
        }

    }
}
